Skip to main content

Customs Declaration

Customs Declaration APIs allow merchants to automatically submit required payment information to customs authorities for cross-border eCommerce transactions. This simplifies the clearance process and saves time for both merchants and consumers.


1. Push Customs Declaration

Endpoint

POST /custom/v1/declare

Request Parameters

FieldRequiredTypeDescription
trade_typeYesString(8)weixin or alipay
syssnYesString(32)QFPay transaction ID
customsYesString(20)Customs authority code, e.g. SHANGHAI_ZS
mch_customs_noYesString(20)Merchant’s customs registration number
action_typeNoString(256)Declaration type (WeChat only): "ADD" for new, "MODIFY" for changes
mch_customs_nameNoString(256)Merchant record name for Alipay, e.g. jwyhanguo_card
out_request_noNoString(32)Merchant order number (Alipay only)
amountNoString(20)Declaration amount (Alipay only), e.g. 2.00

Sub-Order Fields (For Split or Modified Orders)

FieldConditionalTypeDescription
sub_order_noCString(64)Required if the order is split
fee_typeCString(8)Currency (WeChat only, must be CNY)
order_feeCString(8)Sub-order amount in CNY cents. Must equal transport_fee + product_fee
product_feeCString(8)Product amount in CNY cents
transport_feeCString(8)Shipping fee in CNY cents

Response

FieldTypeDescription
syssnString(40)QFPay transaction number
respcdString(4)0000 = Success, 1143/1145 = Query again, others = Failure. See Transaction Status Codes
resperrString(128)Error message
respmsgString(128)Additional message
verify_departmentStringVerifying organisation
verify_department_trade_idStringTrade ID assigned by customs

2. Query Customs Declaration

Endpoint

POST /custom/v1/query
GET /custom/v1/query

Request Parameters

FieldRequiredTypeDescription
trade_typeYesString(8)weixin or alipay
customsYesString(20)Customs code, e.g. SHANGHAI_ZS
syssnYesString(32)QFPay transaction number
sub_order_noNoString(40)Required for split orders

Response

FieldTypeDescription
syssnString(40)QFPay transaction number
respcdString(4)Response code
resperrString(128)Error message
respmsgString(128)Additional message
dataArrayArray of declaration results: includes resperr, errmsg, sub_order_no, verify_department, verify_department_trade_id

3. Repush Customs Declaration

Use this when a declaration was lost on the customs end.

Endpoint

POST /custom/v1/redeclare

Request Parameters

FieldRequiredTypeDescription
trade_typeYesString(8)weixin or alipay
customsYesString(20)Customs code
syssnYesString(32)QFPay transaction number
mch_customs_noYesString(20)Merchant’s customs registration number
sub_order_noNoString(40)Required for split orders

Response

Same format as push declaration above.


For a complete list of return codes, see Transaction Status Codes.